/**
 * 
 * Copyright (C) 2015 by Elcom Software Company
 *
 * @id: JobTime.java, Mar 13, 2015
 *
 */
package com.nip.commons.job.objects;

import java.util.Calendar;
import java.util.Date;

import com.nip.commons.job.interf.IJobTime;

/**
 * @author ThangNM<thangnm@elcom.com.vn>
 *
 * @version v
 */
public class JobTime implements IJobTime{

    private final Calendar cal = Calendar.getInstance();
    
    /* (non-Javadoc)
     * @see com.nip.commons.job.interf.IJobTime#setTime(java.util.Date)
     */
    @Override
    public void setTime(Date time) {
        // TODO Auto-generated method stub
        cal.setTime(time);
    }

    /* (non-Javadoc)
     * @see com.nip.commons.job.interf.IJobTime#getYear()
     */
    @Override
    public int getYear() {
        // TODO Auto-generated method stub
        return cal.get(Calendar.YEAR);
    }

    /* (non-Javadoc)
     * @see com.nip.commons.job.interf.IJobTime#getMonth()
     */
    @Override
    public int getMonth() {
        // TODO Auto-generated method stub
        return cal.get(Calendar.MONTH)+1;
    }

    /* (non-Javadoc)
     * @see com.nip.commons.job.interf.IJobTime#getHour()
     */
    @Override
    public int getHour() {
        // TODO Auto-generated method stub
        return cal.get(Calendar.HOUR_OF_DAY);
    }

    /* (non-Javadoc)
     * @see com.nip.commons.job.interf.IJobTime#getMunite()
     */
    @Override
    public int getMunite() {
        // TODO Auto-generated method stub
        return cal.get(Calendar.MINUTE);
    }

    /* (non-Javadoc)
     * @see com.nip.commons.job.interf.IJobTime#getDayOfWeek()
     */
    @Override
    public int getDayOfWeek() {
        // TODO Auto-generated method stub
        return cal.get(Calendar.DAY_OF_WEEK);
    }

    /* (non-Javadoc)
     * @see com.nip.commons.job.interf.IJobTime#getDay()
     */
    @Override
    public int getDay() {
        // TODO Auto-generated method stub
        return cal.get(Calendar.DAY_OF_MONTH);
    }

    /* (non-Javadoc)
     * @see com.nip.commons.job.interf.IJobTime#getTime()
     */
    @Override
    public Date getTime() {
        // TODO Auto-generated method stub
        return cal.getTime();
    }

}
